#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Stu
{
	char name[20];
	int age;
};

int cmp_name(const void* p1, const void* p2)
{
	return strcmp(((struct Stu*)p1)->name, ((struct Stu*)p2)->name);
}

void print_name(struct Stu arr[], int sz)
{
	for (int i = 0; i < sz; i++)
	{
		printf("%s\n", arr[i].name);
	}
}

int main()
{
	struct Stu arr[3] = { {"zhangsan",18},{"lisi",25},{"wangwu",17} };
	int sz = sizeof(arr) / sizeof(arr[0]);
	qsort(arr, sz, sizeof(arr[0]), cmp_name);
	print_name(arr, sz);

	return 0;
}